<!DOCTYPE html>
<!--
Copyright 2013 The Polymer Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
<html>
  <head>
    <title>Native CustomElements Other Document Upgrade</title>
    <meta charset="UTF-8">
    <script src="../../MDV/mdv.js"></script>
  </head>
  <body>
    <script>
      document.webkitRegister('x-foo', {
        prototype: Object.create(HTMLElement.prototype, {
          isXFoo: {
            value: true
          }
        })
      });
      
      function nodeFromHtml(html) {
        var doc = document.implementation.createHTMLDocument();
        doc.body.innerHTML = html;
        return doc.body.firstChild;
      }
      
      var node1 = nodeFromHtml('<div><x-foo>XFoo One</x-foo></div>');
      document.body.appendChild(node1);
      
      var node2 = nodeFromHtml('<x-foo>XFoo Two</x-foo>');
      document.body.appendChild(node2);
      
      
      Array.prototype.forEach.call(document.querySelectorAll('x-foo'), 
        function(node) {
          console.log('upgraded', node.isXFoo);
        }
      );
    </script>
  </body>
</html>
